package com.java1234.jxc.beans;

import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * Created by Administrator on 2018/3/16.
 */
@Table("t_user")
public class SysUser  implements Serializable {


    @Column
    @Comment("编号")
    @Id
    @Prev({
            @SQL(db= DB.MYSQL,value = "SELECT IFNULL(MAX(id),0)+1 FROM t_user"),
            @SQL(db= DB.ORACLE,value = "SELECT COALESCE(MAX(id),0)+1 FROM t_user")
    })
    private Integer id;

    @Column("user_name")
    @Comment("用户名")
    @ColDefine(type = ColType.VARCHAR, width = 50)
    private String userName;

    @Column
    @Comment("密码")
    @ColDefine(type = ColType.VARCHAR, width = 50)
    private String password;

    @Column("true_name")
    @Comment("真实姓名")
    @ColDefine(type = ColType.VARCHAR, width = 50)
    private String trueName;

    @Column("remarks")
    @Comment("备注")
    @ColDefine(type = ColType.VARCHAR, width = 1000)
    private String remarks;

    @ManyMany(from = "user_id", relation = "t_user_role", to = "role_id")
    private List<SysRole> roles;


    private String roleList;

    public String getRoleList() {
        return roleList;
    }

    public void setRoleList(String roleList) {
        this.roleList = roleList;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTrueName() {
        return trueName;
    }

    public void setTrueName(String trueName) {
        this.trueName = trueName;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public List<SysRole> getRoles() {
        return roles;
    }

    public void setRoles(List<SysRole> roles) {
        this.roles = roles;
    }

    @Override
    public String toString() {
        return "SysUser{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", trueName='" + trueName + '\'' +
                ", remarks='" + remarks + '\'' +
                ", roles=" + roles +
                ", roleList='" + roleList + '\'' +
                '}';
    }
}
